<?php $this->load->view('header_solicitud'); ?>
<?php $this->load->view('cuerpo'); ?>
<style type="text/css">
    th, td {
        white-space: nowrap;
    }
    div.dataTables_wrapper {
        width: 100%;
    }
    td.details-control {
        background: url('../images/details_open.png') no-repeat center center;
        cursor: pointer;
    }
    tr.shown td.details-control {
        background: url('../images/details_close.png') no-repeat center center;
    }
</style>
<script type="text/javascript" charset="utf-8">    
    $(document).ready(function() {
        $.datepicker.regional[""].dateFormat = 'dd/mm/yy';
        $.datepicker.setDefaults($.datepicker.regional['']);
        $('#cotizacion').DataTable({
            "bJQueryUI": true,
            "scrollX": true,
            "sPaginationType": "full_numbers",
            "lengthMenu": [[5, 10, 25, 50, -1], ["05", "10", "25", "50", "Todo"]],
            "columns": [
				{ "orderable":      false },
				{ "orderable":      false },
				{ "orderable":      false },
                { "orderable":      true },
                { "orderable":      true },
                { "orderable":      true },
                { "orderable":      true },
                { "orderable":      true },
                { "orderable":      true },
                { "orderable":      true }                
            ],
            "order": [[0, 'desc']]
        });   
        $('#cotizacion').dataTable()
        	     .columnFilter({
							sPlaceHolder: "head:before",
							aoColumns: [{ type: "date-range"},
										{ type: "date-range"}
									   ]
            	     });
    });
</script>
<section id="dt_cotizacion">
    <div id="container" style="width: 100%;">
        <table border="1" class="display" id="cotizacion" width="100%">
            <thead>
            	<tr>
            		<th colspan="12" style="text-align: justify;">
            		</th>
            	</tr>
                <tr>
                	<th>VER</th>
                    <th>COTIZAR</th>
                    <th>CAMBIAR ESTADO</th>
                    <th>N° SOLICITUD</th>
                    <th>FEC. REGISTRO</th>
                    <th>MONEDA</th>
                    <!-- <th>PLACA</th>
                    <th>TALLER</th> -->
                    <th>MARCA</th>
                    <th>MODELO</th>
                    <th>AÑO</th>
                    <th>ESTADO</th>                    
                </tr>
            </thead>
            <tbody>
            <?php
                $item = 1;
                foreach($lstCotizacion as $data) {
                    $codigo = '';
                    $numCaracteres = strlen($data->id_solicitud);
                    for($iPos=0;$iPos<$tamCodigo-$numCaracteres;$iPos++) {
                        $codigo .= '0';
                    }
                    $codigo .= $data->id_solicitud;
                    
                    $nomTaller = '';
                    if ($data->nomTaller != '') {
                        $nomTaller = $data->nomTaller;
                    } else {
                        $nomTaller = $data->otroTaller;
                    }
            ?>
            <tr>
            	<td class="center">
                    <a href="<? echo base_url();?>index.php/cotizacion/cotizar?id=<?=$data->id_cotizacion?>&lectura=1" title="Ver">
                        <img src="<? echo base_url();?>images/ver.png" width="20" height="20"/>
                    </a>
                </td>
                <td class="center">
                    <?php if ($data->idEstadoCot == $estadoPendResp) { ?>
                    <a href="<? echo base_url();?>index.php/cotizacion/cotizar?id=<?=$data->id_cotizacion?>" title="Cotizar">
                        <img src="<? echo base_url();?>images/cotizar.png" width="20" height="20"/>
                    </a>
                    <?php } else { ?>
                    <span>-</span>
                    <?php } ?>
                </td>
                <td class="center">
                    <?php if ($data->idEstadoCot == $estadoOGenerada) { ?>
                    <a href="<? echo base_url();?>index.php/cotizacion/cambiar?id=<?=$data->id_cotizacion?>" title="Cambiar Estado">
                	<img src="<? echo base_url();?>images/cambiar.png" width="20" height="20" />
                    </a>
                    <?php } else { ?>
                    <span>-</span>
                    <?php } ?>
                </td>
                <td class="center"><?= $codigo; ?></td>
                <td class="center"><?php echo date("d/m/Y", strtotime($data->fecha_registro)) ?></td>
				<td class="left"><?= $data->nomMoneda ?></td>
                <!-- <td class="left"><?= $data->placa ?></td>
                <td class="left"><?= $nomTaller ?></td> -->
                <td class="left"><?= $data->nomMarca ?></td>
                <td class="left"><?= $data->nomModelo ?></td>
                <td class="center"><?= $data->anho ?></td>
				<td class="left"><?= $data->nomEstadoCot ?></td>
            </tr>
            <?php } ?>
            </tbody>
	</table>
    </div>
</section>
<?php $this->load->view('footer'); ?>